package com.isoft.service.tableservice;

import com.isoft.dao.tabledao.DfmeLbdeDao;
import com.isoft.entity.tableentity.dfme_lbde.DfmeLbdeMsg;
import com.isoft.utils.TimeFormatUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Timestamp;

@Service
@Slf4j
public class DfmeLbdeService {
    @Autowired
    DfmeLbdeDao dfmeLbdeDao;
    public int insertmsg(DfmeLbdeMsg dfmeLbdeMsg) throws Exception{
        Timestamp create_time = new Timestamp(System.currentTimeMillis());
        Timestamp lbdt= TimeFormatUtils.stringToTimestamp(dfmeLbdeMsg.getDfmeLbdeDflt().getLbdt());
        Timestamp mlbd= TimeFormatUtils.stringToTimestamp(dfmeLbdeMsg.getDfmeLbdeDflt().getMlbd());
        dfmeLbdeDao.insertMeta(create_time,dfmeLbdeMsg.getDfmeLbdeMeta());
        return dfmeLbdeDao.insertDflt(dfmeLbdeMsg.getDfmeLbdeMeta().getSeqn(),create_time,lbdt,mlbd,dfmeLbdeMsg.getDfmeLbdeDflt());
    }

}
